package com.cedifie.lendapp.ui.user.impl

import com.cedifie.lendapp.http.ApiService
import com.cedifie.lendapp.http.ApiService.addCommonParams
import com.cedifie.lendapp.http.HttpHelper
import com.cedifie.lendapp.http.IHttpCallback
import org.json.JSONObject

/**
 * Cedifie
 * @Author wwdeng
 * @CreateTime: 2024/6/14 16:26
 * @Annotation：个人中心 Model 实现
 */
class CedUserModelImpl {

    /**
     * 打分
     */
    fun loadCedRateUsAction(callBack: IHttpCallback){
        val httpUrl = ApiService.getHttpUrl(ApiService.API_URL.CED_API_COMMON_URL)
        val params = JSONObject().addCommonParams().apply {
            put("path", ApiService.API_PATH.CED_API_STAR_COMMENT_PATH)
        }
        HttpHelper.postCedAction(httpUrl,params,callBack)
    }

    /**
     * 是否需要显示清除账号信息按钮、清除账户数据
     */
    fun clearUserDataAction(isShowButton: Boolean,callBack: IHttpCallback){
        val httpUrl = ApiService.getHttpUrl(ApiService.API_URL.CED_API_COMMON_URL)
        val params = JSONObject().addCommonParams().apply {
            put("path", ApiService.API_PATH.CED_API_USER_DATA_CLEAR_PATH)
        }
        if (isShowButton){
            params.put("type","GET")
        } else {
            params.put("type","DROP")
        }
        HttpHelper.postCedAction(httpUrl, params, callBack)
    }
}